package com.guchenbo.study.mvc.servlet31.springboot.jar;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author guchenbo
 * @Date 2019/12/1.
 */
@SpringBootApplication
public class SpringApp implements WebMvcConfigurer {
    @Resource
    private SpringHandlerInterceptor springHandlerInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(springHandlerInterceptor).addPathPatterns("/**").excludePathPatterns("/study2");
    }

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        WebMvcConfigurer.super.configureMessageConverters(converters);
    }

    public static void main(String[] args) {
        SpringApplication.run(SpringApp.class);
    }
}
